package com.gitee.wsl.doc.prosemirror.history.ext

import com.gitee.wsl.doc.prosemirror.history.HistoryOptions
import com.gitee.wsl.doc.prosemirror.history.bean.HistoryState
import com.gitee.wsl.doc.prosemirror.history.mustPreserveItems
import com.gitee.wsl.doc.prosemirror.state.EditorState
import com.gitee.wsl.doc.prosemirror.state.Transaction

fun HistoryState.undone(state: EditorState,
                        tr: Transaction,
                        options: HistoryOptions
) = HistoryState(
    done,
    undone.addTransform(tr, null, options, state.mustPreserveItems()),
    null,
    prevTime,
    prevComposition
)